const Router = require('@koa/router')
const { server } = require('../env')
const auth = require('../middleware/auth')
const { verifyStadium, verifyOrder, verifyPager, verifyRemove } = require('../middleware/order.middleware')
const orderController = require('../controller/order.controller')

const orderRouter = new Router({ prefix: `${server.pathPrefix}/order` })

orderRouter.post('/toggle', auth, verifyStadium, verifyOrder, orderController.toggle) // 创建/结束订单
orderRouter.get('/list', auth, verifyPager, orderController.list) // 获取订单列表
orderRouter.delete('/remove/:id', auth, verifyRemove, orderController.remove) // 删除订单

module.exports = orderRouter